﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Formsy.Data.Linq;
using System.Data;
using Formsy.Common;
using System.Xml.Linq;


namespace Formsy.Data.Interfaces
{
    public interface IFormsyService
    {
        // cached xml document loading
        XDocument LoadXDocument(string path);
        

        // insert and update
        IFormsyEntry InsertEntry(string formName);
        List<IFormsyEntryData> InsertEntryData(int formId, int entryId, Dictionary<string, string> dictionary);
        List<IFormsyEntryData> UpdateEntryData(int entryId, Dictionary<string, string> dictionary);
        List<IFormsyEntryData> UpdateEntryData(int formId, int entryId, Dictionary<string, string> dictionary);
        bool DeleteEntryAndData(int entryId);

        
        // helper methods
        IFormsyForm GetForm(string formName);
        IFormsyForm EnsureFormExists(string formName);
        IFormsyForm CreateForm(string formName);
        List<IFormsyEntryData> GetEntryDatas(int entryId);
        IFormsyEntry GetEntry(int entryId);


        
        // csv methods
        DataTable GetCSV(string competitionName, DateTime start, DateTime end, string path, List<string> ignoreList);
        List<IFormsyEntry> GetEntries(string formName, DateTime start, DateTime end);
        //DataTable GetHeadings(string formName, List<string> mainHeadings, DataTable table, List<string> ignoreList);

        List<string> GetHeadings(string formName, List<string> ignoreList);

    }
}
